import React, { Component } from 'react';
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import * as TodoActions from '../actions'

import List from './List'
import Operate from './Operate'

 
class App extends Component {
     constructor(props, context) {
         super(props, context);
          
     }
      
    render() { 
        debugger
        let {todos, actions,dispatch} = this.props;
        console.log(this.props)
        return (

            <div>
              <List list={todos} />
               <Operate  dispatch={dispatch}  actions={actions}  />
            </div>
        );
    }
}
const mapStateToProps = state => ({
    todos: state.todos
  })
  
  const mapDispatchToProps = dispatch => {
    var s={
      actions: bindActionCreators(TodoActions, dispatch),
      dispatch:dispatch
  };
  
  return s;
  }
  
  export default connect(
    mapStateToProps,
    mapDispatchToProps
  )(App)
  
 